﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace JoyeriaProject
{
    public partial class frmMain : Form
    {
       public delegate void ExplorerFormReturn(string s, int ss);
     
        public frmMain()
        {
            InitializeComponent(); 
              
        }

        private void frmMain_Load(object sender, EventArgs e)
        {
            frmExplorer explorer = new frmExplorer(ReturnedValues);
            explorer.TopLevel = false;
            this.panelExplorer.Controls.Add(explorer);
            explorer.Show();
 

        }

        private void frmMain_Resize(object sender, EventArgs e)
        {
              Application.DoEvents();
         }

 
        protected void ReturnedValues(string values, int CustomerID)
        {

            if (values == "FIND")
            {
                this.panelMain.Controls.Clear();
                frmCustomerFinder CustomerFinder = new frmCustomerFinder(ReturnedValues);
                CustomerFinder.TopLevel = false;
                this.panelMain.Controls.Add(CustomerFinder);
                this.panelMain.Tag = CustomerFinder;
                CustomerFinder.Show();

            }
            else if (values == "NEWCUSTOMER")
            {
                this.panelMain.Controls.Clear();
                frmCustomer Customer = new frmCustomer();
                Customer.TopLevel = false;
                this.panelMain.Controls.Add(Customer);
                this.panelMain.Tag = Customer;
                Customer.Show();

            }
            else if (values == "EDITCUSTOMER")
            {
                this.panelMain.Controls.Clear();
                frmCustomerEdit CustomerEdit = new frmCustomerEdit();
                CustomerEdit.CustomerID = CustomerID;
                CustomerEdit.TopLevel = false;
                this.panelMain.Controls.Add(CustomerEdit);
                this.panelMain.Tag = CustomerEdit;
                CustomerEdit.Show();

            }
            else if (values == "NEWAGENT")
            {
                this.panelMain.Controls.Clear();
                frmAgent Agent = new frmAgent();
                Agent.TopLevel = false;
                this.panelMain.Controls.Add(Agent);
                this.panelMain.Tag = Agent;
                Agent.Show();

            }
            else if (values == "HISTORY")
            {
                this.panelMain.Controls.Clear();
                frmPayHistory History = new frmPayHistory();
                History.TopLevel = false;
                this.panelMain.Controls.Add(History);
                this.panelMain.Tag = History;
                History.Show();
            }
            else if (values == "EXIT")
            {
                Application.Exit();
            }
        }
    
    }
}